/*
 * @Description: 
 * @Version: 2.0
 * @Autor: 刘世琪
 * @Date: 2021-01-08 16:11:16
 * @LastEditors: Seven
 * @LastEditTime: 2021-01-21 21:11:49
 */
import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router)

var routes = [
        // {
        //   path:'/',
        //   name:'index',
        //   component:index
        // },
        {
          path:'/myindex',
          name:'myindex',
          component:() => import('@/components/myindex')       
        },
        {
          path:'/',  // 首页
          name:'Indexs',
          component:() => import('@/components/Indexs')       
        },
        {
          path:'/user',  // 个人中心
          name:'User',
          component:() => import('@/components/User')       
        },
        {
          path:'/my_home',  // 个人中心 新版
          name:'My_Home',
          component:() => import('@/components/My_Home'),
          // 拦截器使用
          beforeEnter: (to, from, next) => {
            
            if(localStorage.getItem("username")){
              console.log('登录');
              next()
            }else{
              next('/my_login')
            }
          }       
        },
        {
          path:'/user_upload',  // 图片展示
          name:'User_Upload',
          component:() => import('@/components/User_Upload')       
        },
        {
          path:'/header',  // 头部
          name:'Header',   
          component:() => import('@/components/Header')
        },
        {
          path:'/body',  // 身部
          name:'Body',   
          component:() => import('@/components/Body')
        },

        {
          path:'/footer',  // 页脚
          name:'Footer',   
          component:() => import('@/components/Footer')
        },
        {
          path:'/my_reg',  // 注册
          name:'Myreg',   
          component:() => import('@/components/Myreg')
        },
        {
          path:'/my_login',  // 登录
          name:'My_Login',   
          component:() => import('@/components/My_Login')
        },
        {
          path:'/headers',
          name:'Headers',   
          component:() => import('@/components/Headers')
        },
        {
          path:'/footers',
          name:'Footers',   
          component:() => import('@/components/Footers')
        },
        {
          path:'/footers',
          name:'Footers',   
          component:() => import('@/components/Footers')
        },
        // 课程功能
        {
          path:'/my_cate',  // 课程分类
          name:'My_Cate',   
          component:() => import('@/components/My_Cate')
        },
        {
          path:'/show_cate',  // 展示分类
          name:'ShowCate',   
          component:() => import('@/components/ShowCate')
        },
        {
          path:'/add_course', // 添加课程
          name:'Add_Course',   
          component:() => import('@/components/Add_Course')
        },
        {
          path:'/course_list', // 展示课程
          name:'Course_list',   
          component:() => import('@/components/Course_list')
        },
        {
          path:'/course_info', // 展示课程
          name:'Course_info',   
          component:() => import('@/components/Course_info')
        },

        // ////////////////////////// 三方登录
        {
          path:'/gite_login', // 码云登录
          name:'Gite_Login',   
          component:() => import('@/components/Gite_Login')
        },
        {
          path:'/ding_login', // 钉钉登录
          name:'Ding_Login',   
          component:() => import('@/components/Ding_Login')
        },
        
       
       
]

export default new Router({
  routes:routes,
  mode:'history'   /*hash*/
})


